package com.dc.docs._888_面试.concurrent._3_collection;

import cn.hutool.core.lang.UUID;
import com.google.common.collect.Lists;

import java.util.List;

/**
 * Description: 集合类不安全问题_ArrayList
 * @author: gdc
 * @date: 2021/6/15
 * @version 1.0
 */
public class ArrayListNotSafeDemo {

    public static void main(String[] args){
        List<String> list = Lists.newArrayList();
        for (int i = 0; i < 50; i++) {
            new Thread(() -> {
                UUID uuid = UUID.fastUUID();
                list.add(uuid.toString());

                System.out.println(list);
            }, String.valueOf(i)).start();
        }
    }
}
